<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js_修饰</title>
    <script>
        function $(id){return document.getElementById(id);}
        window.onload = function(){
        $("div1").style.width = 200+'px';
        $("div1").style.height = 200+'px';
        $("div1").style.border = '1px solid red';
        $("div1").style.borderRadius = '100px';
        $("div1").style.background = 'blue';
        $("but").addEventListener("click",function(){
        count++;
        if(count%2!=0){
        $("div1").className = "yin";

        }else{
        $("div1").className = "xian";
        }
        })
        }
    </script>
    <style>
        .xian{display:block;}
        .yin{display:none;}
    </style>
</head>
<body>
<button id="but">显示/隐藏</button>
<div id="div1"></div>
</body>
</html>